package com.ukao.pad.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.ukao.pad.eventbus.MainEvent;

import static com.ukao.pad.eventbus.MainEvent.Message.login;

/**
 * Created by ukaodev on 2017/7/14.
 */

public class StringBean implements Parcelable {

    /**
     * id : 1
     * amt : 10
     * name : 加急
     */
    private String id;
    private int amt;
    private String name;
    private  int  typeEnter;
    private  String  desc;
    public String getId() {
        return id;
    }



    public int getAmt() {
        return amt;
    }

    public String getName() {
        return name;
    }
    public StringBean(String id ,String  name) {
        this.id=id;
        this.name=name;
    }



    /**
     * data : 17
     * httpCode : 200
     * msg : 请求成功
     * timestamp : 1500017024477
     */

    private String data;
    private int httpCode;
    private String msg;
    private long timestamp;






    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public int getHttpCode() {
        if (httpCode==403||httpCode==401){
            MainEvent.postNoData(login);
        }
        return httpCode;
    }

    public void setHttpCode(int httpCode) {
        this.httpCode = httpCode;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeInt(this.amt);
        dest.writeString(this.name);
        dest.writeInt(this.typeEnter);
        dest.writeString(this.desc);
        dest.writeString(this.data);
        dest.writeInt(this.httpCode);
        dest.writeString(this.msg);
        dest.writeLong(this.timestamp);
    }

    protected StringBean(Parcel in) {
        this.id = in.readString();
        this.amt = in.readInt();
        this.name = in.readString();
        this.typeEnter = in.readInt();
        this.desc = in.readString();
        this.data = in.readString();
        this.httpCode = in.readInt();
        this.msg = in.readString();
        this.timestamp = in.readLong();
    }

    public static final Creator<StringBean> CREATOR = new Creator<StringBean>() {
        @Override
        public StringBean createFromParcel(Parcel source) {
            return new StringBean(source);
        }

        @Override
        public StringBean[] newArray(int size) {
            return new StringBean[size];
        }
    };
}
